<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>nl2br</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="Smarty マニュアル">
<link rel="up" href="language.modifiers.html" title="Chapter 5. 変数の修飾子">
<link rel="prev" href="language.modifier.lower.html" title="lower">
<link rel="next" href="language.modifier.regex.replace.html" title="regex_replace">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">nl2br</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="language.modifier.lower.html">Prev</a> </td>
<th width="60%" align="center">Chapter 5. 変数の修飾子</th>
<td width="20%" align="right"> <a accesskey="n" href="language.modifier.regex.replace.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="nl2br">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="language.modifier.nl2br"></a>nl2br</h2></div></div></div>
<p>
   与えられた変数内の全ての改行文字 <code class="literal">"\n"</code>
   を html の <code class="literal">&lt;br /&gt;</code> タグに変換します。
   これは PHP の <a class="ulink" href="http://php.net/nl2br" target="_top">
   <code class="varname">nl2br()</code></a> 関数と同義です。
  </p>
<div class="example">
<a name="id2761692"></a><p class="title"><b>Example 5.14. nl2br</b></p>
<div class="example-contents">
<pre class="programlisting">

&lt;?php

$smarty-&gt;assign('articleTitle',
                "Sun or rain expected\ntoday, dark tonight"
                );

?&gt;

   </pre>
<p>
    テンプレート
   </p>
<pre class="programlisting">

{$articleTitle|nl2br}

   </pre>
<p>
    出力
   </p>
<pre class="screen">

Sun or rain expected&lt;br /&gt;today, dark tonight

   </pre>
</div>
</div>
<br class="example-break"><p>
   <a class="link" href="language.modifier.wordwrap.html" title="wordwrap"><code class="varname">word_wrap</code></a>、
   <a class="link" href="language.modifier.count.paragraphs.html" title="count_paragraphs"><code class="varname">count_paragraphs</code></a>
   および
   <a class="link" href="language.modifier.count.sentences.html" title="count_sentences"><code class="varname">count_sentences</code></a>
   も参照してください。
  </p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="language.modifier.lower.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="language.modifiers.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="language.modifier.regex.replace.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">lower </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> regex_replace</td>
</tr>
</table>
</div>
</body>
</html>
